$(function () {
    var initurl = '/person/getPerson?token='+localStorage.getItem('token');
    //初始化相关信息
    show();

    function show() {
        $.getJSON(initurl,function (data) {
            if (data.success) {
                var phone = data.data.phone;
                var n_phone = phone.substring(0,3)+'****'+phone.substring(7);
                var mail = data.data.mail;
                if (mail != null && mail != ''){
                    mail = mail.substring(0,3)+'****'+mail.substring(7);
                    $('#show-mail').text('邮箱已绑定');
                }else {
                    $('#mailhref').attr('href','/person/bindMail');
                    $('#show-mail').text('邮箱未绑定');
                }
                if (phone == null || phone == '') {
                    $('#phone').text('手机号未绑定');
                }else{
                    $('#phone').text(n_phone);
                    $('#phonehref').attr("href","/person/modifyMobile?phone="+phone);
                }
                $('#mail').text(mail);
            }
        })
    }
});
